<?php
class Application_Model_Authorization extends Zend_Db_Table_Abstract 
{
    protected $_name = 'admins';
    
    /**
     * получаем id_role Админа
     * @param int $id
     * @return array 
     */
    public function getAdminIdRole($id) {
        $select = $this->select()
                       ->from($this->_name)
                       ->where('id =?', intval($id));
        return $this->fetchAll($select)->toArray();
    }            
    
    /**
     * получаем id_role рекламодателя
     * @param int $id
     * @return array 
     */
    public function getAdverIdRole($id) {
        $this->_name = 'advertisers';
        $select = $this->select()
                       ->from($this->_name)
                       ->where('id =?', intval($id));
        return $this->fetchAll($select)->toArray();
    }      
    
    /**
     * получаем id_role публикатора
     * @param int $id
     * @return array 
     */
    public function getPubIdRole($id) {
        $this->_name = 'publishers';
        $select = $this->select()
                       ->from($this->_name)
                       ->where('id =?', intval($id));
        return $this->fetchAll($select)->toArray();
    } 
    
    /**
     * получаем имя роли
     * @param int $id_role
     * @return array 
     */
    public function getRoleName($id_role){
        $this->_name = 'roles';
        $select = $this->select()->from($this->_name)
                ->where('id = ?', $id_role);
        return $this->fetchAll($select)->toArray();
    }       
}